package org.zoomdev.zoom;

import org.junit.Test;
import org.zoomdev.zoom.dao.Dao;
import org.zoomdev.zoom.dao.driver.mysql.MysqlDriver;

public class CreateDb {

    public static void create(Dao dao) {
        try {
            dao.builder().dropIfExists("sys_ensure").build();
            dao.builder().createIfNotExists("sys_ensure").comment("ensure")
                    .add("id").integerUnsigned().keyPrimary().autoIncement().comment("id")
                    .add("type").integerUnsigned().comment("类型")
                    .add("data").blob().comment("调用数据")
                    .add("state").tinyIntUnsigned().keyIndex().comment("状态码 0 正常 1 失败 2 成功 3 已完成").notNull().defaultValue("0")
                    .add("cr_time").timestamp().comment("创建时间").defaultFunction(MysqlDriver.CURRENT_TIMESTAMP)
                    .add("retry").integerUnsigned().comment("重试次数").defaultValue("0")
                    .add("exception").blob().comment("错误原因")
                    .build();

        } catch (Exception e) {
            //e.printStackTrace();
            // throw new ZoomException(e);
        }
    }




}
